/**
 * User: alesj
 * Date: 2005.2.10
 * Time: 11:21:30
 * 
 * (C) Genera Lynx d.o.o.
 */

package com.generalynx.ecos.data.dao;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import java.util.List;
import java.util.Map;

public class SqlDAOImpl extends SqlMapClientDaoSupport implements IAdvancedSqlDAO {

    public Object get(String statementName, int id) throws DataAccessException {
        return getSqlMapClientTemplate().queryForObject(statementName, new Integer(id));
    }

    public Object insert(String statementName, Object object) throws DataAccessException {
        return getSqlMapClientTemplate().insert(statementName, object);
    }

    public int update(String statementName, Object object) throws DataAccessException {
        return getSqlMapClientTemplate().update(statementName, object);
    }

    public int delete(String statementName, Object object) throws DataAccessException {
        return getSqlMapClientTemplate().delete(statementName, object);
    }

    public List select(String statementName, Object object) throws DataAccessException {
        return getSqlMapClientTemplate().queryForList(statementName, object);
    }

    public Map selectForMap(String statementName, Object object, String keyProp)
            throws DataAccessException {
        return getSqlMapClientTemplate().queryForMap(statementName, object, keyProp);
    }

    public Object procedureObject(String statementName, Map params) throws DataAccessException {
        return getSqlMapClientTemplate().queryForObject(statementName, params);
    }

    public List procedureList(String statementName, Map params) throws DataAccessException {
        return getSqlMapClientTemplate().queryForList(statementName, params);
    }

/*
    public void selectWithRowHandler(String statementName, Object object, RowHandler rowHandler)
            throws DataAccessException {
        getSqlMapClientTemplate().queryWithRowHandler(statementName, object, rowHandler);
    }
*/

}
